<template>
  <div class="app-container">
    <el-button type="primary">导出全部</el-button>
    <el-button type="primary">导出最新</el-button>
    <myTable
      ref="mytable"
      :config="tableconfig"
    >
      <div slot="mytablebody"></div>
      <!-- 操作 -->
      <template v-slot:operation="{ data }">
        <el-button type="primary">已导出</el-button>
        <!-- <el-button type="danger">未导出</el-button> -->
      </template>

    </myTable>
  </div>
</template>
<script>
import {informationList} from '@/api/feedback'
export default {
  data() {
    return {
      tableconfig: {
        loading: false,
        isselection: false,
        ispagination: true,
        tabledata: [],
        isindex: true,
        thead: [
          { sort: null, label: "序号", prop: "mfrId", width: 100 },
          { sort: null, prop: "companyName", label: "公司名称",  },
          { sort: null, prop: "userName", label: "姓名",  },
          { sort: null, prop: "tel", label: "手机号", },
          { sort: null, label: "提交时间", prop: "time" },
          { sort: null, label: "导出状态", prop: "operation",type: "slot", },
        ],
        currentpage: 1,
        pagesize: 0,
        total: 0,
      },
      form:{
        pageNo:1,
        pageSize:20,
      }
    }
  },
  created(){
    this.doQuery()
  },
  methods: {
    doQuery(){
    this.tableconfig.currentpage = this.form.pageNo;
    this.tableconfig.pagesize = this.form.pageSize;
      informationList(this.form).then(res=>{
        if(res.success){
          this.tableconfig.total = res.result.total;
          this.tableconfig.tabledata = res.result.records

        }else{
          this.$message.error(res.message)
        }
      })
    },
    // 页码数更新
    handleSizeChange(val) {
      this.form.pageNo = 1;
      this.form.pageSize = val;
      this.doQuery();
      //表格回到顶部
      this.$refs.mytable.$emit('handleGoTop');
    },
    // 当前页码更新
    handleCurrentChange(val) {
        this.form.pageNo = val;
        console.log(this.form.pageNo,'this.tableconfig.currentpage');
        this.doQuery();
        //表格回到顶部
        this.$refs.mytable.$emit('handleGoTop');
    },
  },
};
</script>
<style lang="scss" scoped>
.app-container{
    width: 100%;
    padding: 20px 30px;
}
  
</style>
